#pragma once
#include "HashTable.h"
namespace jib {
	template<class K,class V>
	class unorderedmap
	{
		struct MapKeyOfT
		{
			const K& operator()(const pair<K, V>& kv)
			{
				return kv.first;
			}
		};
	public:
		typedef typename Hash_Bucket::Hash_Bucket<K, pair<K, V>, MapKeyOfT>::iterator iterator;
		typedef typename Hash_Bucket::Hash_Bucket<K, pair<K, V>, MapKeyOfT>::const_iterator const_iterator;
		iterator begin()
		{
			return _hb.begin();
		}
		const_iterator begin() const
		{
			return _hb.begin();
		}
		iterator end()
		{
			return _hb.end();
		}
		const_iterator end() const
		{
			return _hb.end();
		}
		pair<iterator,bool> Insert(const pair<K,V>& kv)
		{
			return _hb.Insert(kv);
		}
		V& operator [](const K& key)
			{
			pair<iterator, bool> ret = _hb.Insert(make_pair((key), V()) );
			return ret.first->second;
			}
	private:
		Hash_Bucket::Hash_Bucket<K, pair<K, V>, MapKeyOfT> _hb;
	};
}